#! /bin/sh
#### Run GBmod with Xwindow Graphics
#### Create Figure 7 in the GBmod paper

# model number
model=4

#  datadir directory
datadir=../datadir/

####  aux files
modelfile=${datadir}model${model}.data
rayendsfile=${datadir}rayend.data
rayfile=${datadir}ray.data

nangle=150 nxz=201 fangle=-45 langle=45
target=5  nt=21

####   create modelpsfile 
# ../Models/Xmodel${model}

####   reflections from interface 5
triray <$modelfile >$rayendsfile \
        rayfile=$rayfile nangle=$nangle \
        nxz=$nxz  xs=5 zs=1.2 \
        fangle=$fangle langle=$langle \
        refseq=$target,1 refseq=2,-1 krecord=2 

xgraph linecolor=3 <$rayfile -geom 600x300+670+0 nplot=`cat outpar` n=$nxz \
        x1beg=0 x1end=10 x2beg=0 x2end=20  style=seismic linecolor=3 \
        label1="Depth (km)" label2="Distance (km)" title="Raypaths" &

####   reflections from interface 7
target=7
triray <$modelfile >$rayendsfile \
        rayfile=$rayfile nangle=$nangle \
        nxz=$nxz  xs=5 zs=1.2 \
        fangle=$fangle langle=$langle \
        refseq=$target,1 refseq=2,-1 krecord=2

xgraph linecolor=3 <$rayfile -geom 600x300+670+330 nplot=`cat outpar` n=$nxz \
        x1beg=0 x1end=10 x2beg=0 x2end=20  style=seismic linecolor=3 \
        label1="Depth (km)" label2="Distance (km)" title="Raypaths"  &

####   reflections from interface 8
target=8
triray <$modelfile >$rayendsfile \
        rayfile=$rayfile nangle=$nangle \
        nxz=$nxz  xs=5 zs=1.2 \
        fangle=$fangle langle=$langle \
        refseq=$target,1 refseq=2,-1 krecord=2

xgraph linecolor=3 <$rayfile -geom 600x300+670+660 nplot=`cat outpar` n=$nxz \
        x1beg=0 x1end=10 x2beg=0 x2end=20  style=seismic linecolor=3 \
        label1="Depth (km)" label2="Distance (km)" title="Raypaths"  &

#### Create X-Windows display of model
sxplot <$modelfile -geom 600x300+0+0 tricolor=none \
        label1="Depth (km)"   label2="Distance (km)" &


exit 0


